package model;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

/**
 * 
 * @author rocha
 * @deprecated
 */
public class GraphNew {
	
	
	
	/**
	 * list of the edges
	 */
	private java.util.List<Vertex> vertexs;
	
	public java.util.List<Vertex> getVertexs() {
		return vertexs;
	}	
	public void setVertexs(java.util.List<Vertex> vertexs) {
		this.vertexs = vertexs;
	}
	
	/**
	 * constructor default 
	 */
	public GraphNew() {
		this.vertexs = new java.util.ArrayList<Vertex>();
	}
	
	/**
	 * obtained adjacents vertexs at the graph specified by index orientation
	 * @param o orientation
	 * @return vertex specific
	 */
	public Vertex getAdjacents(int o) {
		return vertexs.get(o);
	}	
	
	/**
	 * override to information at the total graph 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		int i = 0;
		for (Vertex v : this.vertexs) {
			builder.append("Adj[");
			builder.append( i++ );
			builder.append("] = ");
			builder.append(v.toString().replace('[', '{').replace(']', '}'));
			builder.append("\n");
		}
		return builder.toString();
	}

	/**
	 * search at minor way at the two vertex
	 * @param home vertex home(local/initial)
	 * @param fate vertex fate(destination/finish)
	 * @return list of the vertxs with the minor way 
	 */
	public java.util.List<Vertex> minorWay(Vertex home, Vertex fate) {
		
		/*
		 * initialize
		 */
		int i = 0, j = 0;
		Vertex minor = null, actual = null; 
		Vertex[] vector = null; //new Vertex[this.vertxs.size()];
		
		/*
		 * ?
		 */
//		vector[j++] = home;	
//		for (Vertex v : this.vertexs) {
//			v.setCust(9999);
//			v.setPrevious(null);
//		}
		
		/*
		 * ?
		 */
//		actual = home;
//		actual.setCust(0); 		
//		java.util.Set<Vertex> neighbors = actual.obtainNextNeighbor();
		
		/*
		 * ?
		 */
//		if (neighbors == null)
//			return null;		
//		for (Vertex neighbor : neighbors) {
//			neighbor.setPrevious(actual);
//		}
		
//		while (actual.compareTo(fate) != 0) {
//			minor = null;
//			
//			for (Vertex vertex : this.vertexs) {				
//				if ( !this.isAcknowledge(vertex) )
//					minor = (minor == null) ? vertex : minor;
//				
//				if ( actual.getCust() + actual.getWeight(vertex) < vertex.getCust() ) { 
//					if ( actual.getWeight(vertex) < 999 ) {
//						vertex.setCust( actual.getCust() + actual.getWeight(vertex) );
//						vertex.setPrevious( actual );
//					}
//				}
//				
//				if ( actual.getWeight(vertex) < minor.getCust() )
//					vertex.setPrevious( actual );	
//			}
//			
//			actual = minor;
//			vector[j++] = actual;
//			
//		}
		
		/*
		 * ?
		 */
//		Stack pilha = new Stack();
//		Vertex[] retorno = new Vertex[vector.length];
//		actual = vector[j - 1];
//		i = 0;
//		
//		while (actual != null) {
//			pilha.push(actual);
//			actual = actual.getPrevious();
//		}
		
		/*
		 * ?
		 */
//		j = pilha.size();
//		for (i = 0; i < j; i++)
//			retorno[i] = (Vertex)pilha.pop();
//		
//		//return retorno;
		return null;
		
	}

	public boolean isAcknowledge(Vertex vertex ) {
		return false;
	}
	
	
}